﻿@using Gpsys.Web.Common
@model Gpsys.Web.Models.UserEntityModel
@{
    ViewBag.Title = "Edit User";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="mws-panel grid_8">
    <div class="mws-panel-header">
        <span>@ViewBag.FormTitle</span>
    </div>
    <div class="mws-panel-body no-padding">
        @using (Html.BeginForm(ViewBag.IsUpdate ? "Edit" : "Create", "User", FormMethod.Post, new { @class = "mws-form" }))
        {
            if (ViewBag.Valid == false)
            {
                <div class="mws-form-message error">
                    @Html.ValidationSummary()
                </div>
            }
            
            @Html.HiddenFor(m => m.User.Id);
            
            <div class="mws-form-inline">
                <div class="mws-form-row">
                    <label class="mws-form-label">
                        UserName</label>
                    <div class="mws-form-item small">
                        @if (!ViewBag.IsUpdate)
                        {
                            @Html.TextBoxFor(m => m.User.UserName)
                        }
                        else
                        {
                            @Model.User.UserName
                        }
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">
                        Name</label>
                    <div class="mws-form-item large">
                        @Html.TextBoxFor(m => m.User.Name)
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">
                        Description</label>
                    <div class="mws-form-item large">
                         @Html.TextBoxFor(m => m.User.Description)
                    </div>
                </div>
                @if (ViewBag.IsUpdate)
                {
                    <div class="mws-form-row">
                        <label class="mws-form-label">
                            Created On</label>
                        <div class="mws-form-item large">
                            @Model.User.CreatedOn
                        </div>
                    </div>

                    <div class="mws-form-row">
                        <label class="mws-form-label">
                            Last Login</label>
                        <div class="mws-form-item large">
                            @Model.User.LastLogin
                        </div>
                    </div>
                }
            </div>
            <div class="mws-button-row">
                <input type="submit" value="Submit" class="btn btn-danger" />
            </div>
        }
    </div>
</div>
